using LiJ.Common.Core.Enums;
using System.Collections.Generic;

namespace LiJ.Common.Core
{
	/// <summary>
	/// 搜索实体
	/// </summary>
	public class SearchMo
	{
		private int _curntPage = 1;

		private int _pageSize = 20;

		/// <summary>
		/// 当前页
		/// </summary>
		public int CurrentPage
        {
            get
            {
                if (_curntPage > 0)
                {
                    return _curntPage;
                }
                return 1;
            }
            set => _curntPage = value;
        }

        /// <summary>
        /// 页面大小
        /// </summary>
        public int PageSize
        {
            get
            {
                if (_pageSize > 0)
                {
                    return _pageSize;
                }
                return 20;
            }
            set => _pageSize = value;
        }

        /// <summary>
        ///    起始行 -只读属性
        /// </summary>
        public int StartRow => (CurrentPage - 1) * PageSize;

        /// <summary>
        /// 排序集合      适用于多个查询条件
        /// </summary>
        public Dictionary<string, SortType> OrderDics
		{
			get;
			set;
		}

		/// <summary>
		/// 搜索关键字集合      适用于多个查询条件
		/// </summary>
		public Dictionary<string, string> FilterDics
		{
			get;
			set;
		}

		/// <summary>
		///   构造函数
		/// </summary>
		public SearchMo()
		{
            FilterDics = new Dictionary<string, string>();
            OrderDics = new Dictionary<string, SortType>();
		}
	}
}
